package com.weiyuwqj.controller.item;

import com.weiyuwqj.api.service.BasItemService;
import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.api.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhangyong on 2016/11/25.
 * 项目列表
 */
@Controller
@RequestMapping("/item")
public class ItemController {

    @Autowired
    BasItemService itemService;

    /**
     * pc历史项目列表
     * @param p
     * @return
     */
    @ResponseBody
    @RequestMapping("/getPcHistoryItemList")
    public Object getPcHistoryItemList(Paginator p){
        return null;// itemService.getPcHistoryItemList(p);
    }

    /**
     * pc可投项目列表
     * @param p
     * @return
     */
    @ResponseBody
    @RequestMapping("/getPcItemList")
    public Object getPcItemList(Paginator p,Integer itemCycle,Integer itemType,Integer itemRepayMethod,Integer itemRate){
        Map map=new HashMap();
        if(itemCycle == 1){
            map.put("itemCycleMin",30);
            map.put("itemCycleMax",60);
        }else if(itemCycle == 2){
            map.put("itemCycleMin",60);
            map.put("itemCycleMax",90);
        }else if(itemCycle == 3){
            map.put("itemCycleMin",90);
            map.put("itemCycleMax",180);
        }else if(itemCycle == 4){
            map.put("itemCycleMin",180);
        }else if(itemCycle == 5){
            map.put("itemCycleMax",30);
        }
        if(itemRate == 1){
            map.put("itemRateMin",new BigDecimal(7));
            map.put("itemRateMax",new BigDecimal(8));
        }else if(itemRate == 2){
            map.put("itemRateMin",new BigDecimal(8));
            map.put("itemRateMax",new BigDecimal(10.88));
        }else if(itemRate == 3){
            map.put("itemRateMin",new BigDecimal(10.88));
            map.put("itemRateMax",new BigDecimal(12.68));
        }
        map.put("itemRepayMethod",itemRepayMethod);
        map.put("itemType",itemType);
        return null;// itemService.pcItemList(p,map);
    }


    /**
     * 项目列表
     * @return
     */
    @RequestMapping(value="/investmentList")
    public Object investmentList(){
        return "main/investment/investmentList";
    }
}
